//
// Created by pzw on 23-12-27.
//

#include "VpnProxyServer.h"
#include <iostream>
#include <vector>

int selectServer(const std::vector<Server> &servers) {
    int choice;
    displayServerList(servers);
    std::cout << "请选择一个服务器：";
    std::cin >> choice;
    if (choice < 1 || choice > servers.size()) {
        std::cout << "无效的选择！" << std::endl;
        return -1;
    }
    return choice - 1;
}

void displayServerList(const std::vector<Server> &servers) {
    std::cout << "可用服务器列表：" << std::endl;
    for (int i = 0; i < servers.size(); i++) {
        std::cout << i + 1 << ". " << servers[i].name << " (" << servers[i].location << ")" << std::endl;
    }
}

int vpn_proxy_server_main() {
    std::vector<Server> servers = {
            {"Server 1", "server1.example.com", "地理位置1"},
            {"Server 2", "server2.example.com", "地理位置2"},
            {"Server 3", "server3.example.com", "地理位置3"}
    };

    int selectedServerIndex = selectServer(servers);
    if (selectedServerIndex != -1) {
        Server selectedServer = servers[selectedServerIndex];
        std::cout << "您选择了服务器：" << selectedServer.name << " (" << selectedServer.location << ")" << std::endl;
        // 在这里可以进行与所选服务器相关的操作
    }

    return 0;
}